package com.buyouchina.web.action.privilege;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import com.buyouchina.bean.PageView;
import com.buyouchina.bean.privilege.PrivilegeGroup;
import com.buyouchina.service.privilege.PrivilegeGroupService;
import com.buyouchina.web.action.BaseAction;
import com.opensymphony.xwork2.ModelDriven;

@Controller
public class PrivilegeGroupListAction extends BaseAction implements ModelDriven<PrivilegeGroup>{
	private static final long serialVersionUID = -2429431294729990025L;
	private PrivilegeGroup privilegeGroup = new PrivilegeGroup();
	@Resource private PrivilegeGroupService privilegeGroupService;
	@Override
	@Permission(model="privilegeGroup",privilegeValue="view")
	public String execute() throws Exception {
		PageView<PrivilegeGroup> pageView = new PageView<PrivilegeGroup>(12,this.getPage());
		pageView.setQueryResult(privilegeGroupService.getScrollData(pageView.getFirstResult(), pageView.getMaxresult()));
		request.setAttribute("pageView", pageView);
		return SUCCESS;
	}

	public PrivilegeGroup getModel() {
		return privilegeGroup;
	}
	
}
